`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date: 2020/09/26 13:18:38
// Design Name: 
// Module Name: booth_partial
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//////////////////////////////////////////////////////////////////////////////////


module booth_partial(
    input [63:0] X,
    input y0,
    input y1,
    input y2,
    input [5:0]shift,
    output [63:0] P,
    output c
    );
    wire S_minus_x,S_minus_2x,S_add_x,S_add_2x;
    wire [63:0] X1;
    assign S_minus_x=~(~(y2&y1&~y0)&~(y2&~y1&y0));
    assign S_add_x=~(~(~y2&y1&~y0)&~(~y2&~y1&y0));
    assign S_minus_2x=~(~(y2&~y1&~y0));
    assign S_add_2x=~(~(~y2&y1&y0));
    assign X1=X<<shift;
    assign P=~(~({64{S_minus_x}}&~X1)&~({64{S_minus_2x}}&~{X1[62:0],1'b0})&~({64{S_add_x}}&X1)&~({64{S_add_2x}}&{X1[62:0],1'b0}));

    assign c=S_minus_x|S_minus_2x;
endmodule
